import React from 'react';

export class ControlForm extends React.Component {
  constructor() {
    // 初始化 this
    super();
    this.state = {
      input: 'hello react',
    };
  }

  handleChange = (e) => {
    // 设置输入状态
    this.setState({
      input: e.target.value,
    });
  };

  render() {
    // console.log(this.state.input);
    return (
      <div>
        <input
          type={'text'}
          value={this.state.input}
          onChange={this.handleChange}
        />
      </div>
    );
  }
}
